const treeData = [
    {
        name: "root",
        children: [
            { name: "src", children: [{ name: "index.html" }] },
            { name: "public", children: [] },
        ],
    },
    {
        name: "root2",
        children: [
            { name: "src2", children: [{ name: "index2.html" }] },
            { name: "public2", children: [] },
        ],
    }
];

let res = []
function getRoutesName(treeData) {
    treeData.forEach(item => {
        const {name,children} = item
        res.push(name)
        if (children) {
            getRoutesName(children)
        }
    })
    return res
}

console.log(getRoutesName(treeData))
